/**
 * Created by Administrator on 2017/2/11.
 */
function next(){
var anm="rb,li,mk,pd";
    var anms=anm.split(",");
    var perAnmPst=100/anms.length;
    perAnmPst.forEach();
    for(idx in anms)
    {
        var an=anms[idx];

    }
    console.log("--f");
}

/**
 *         console.log(fields);

 * @param err
 * @param rows
 * @param fields   fields is field meta data.
 */
    function  queryHandler(err, rows, fields) {
       if (err) {  throw err;   }
        console.log(rows);
     //   console.log(fields);
   //  sys.puts("---------------------------------------Hello bbbb");
     //   console.log(fields);



}
function  main()
{
var sql="  select  getpct(count(*)) 概率,动物  from tab1 GROUP BY 动物 order by 概率 desc  ";
    query(sql,queryHandler);
}

main();
// 加载 mysql module

function query(sql,afterFun)
{



var mysql = require("mysql");



var dataBaseLinkInfo = {



    "host": '127.0.0.1',



    "database": 'game',



    "port": 3307,



    "user": 'root',



    "password": ""



}



var connection = mysql.createConnection(dataBaseLinkInfo);



connection.connect();



connection.query(sql,afterFun )



connection.end();
}